home *** CD-ROM | disk | FTP | other *** search
- -- pointAtSprite
-
-
- --Points a QT3 sprite at any other Director sprite.
- --
- --PARAMETERS:
- --
- --Point at sprite - Specify the channel # of the sprite to point at
- --
- --NOTE: Assumes QT3 sprite points left to right --> when angle is 0.0
-
- property pointAtSpriteNum
-
- on prepareFrame me
-
- -- note, to point at an arbitrary point, substitute 'the loch of sprite pointAtSpriteNum'
- -- and 'the locv of sprite pointAtSpriteNum' with the coords to point at
-
- -- determine slope
- set deltah = the loch of sprite pointAtSpriteNum - the loch of sprite the spritenum of me
- set deltav = the locv of sprite pointAtSpriteNum - the locv of sprite the spritenum of me
-
- -- determine angle given slope
- if deltah <> 0 then
- set slope = (deltav + 0.0) / (deltah) + 0.0
- set angle = atan(slope) * 180.0 / pi
- if deltah < 0 then
- set angle = angle + 180.0
- end if
- else
- if deltav > 0 then
- set angle = 90.0
- else
- set angle = 270.0
- end if
- end if
-
- -- set the new rotation
- set tempRotation = the rotation of sprite the spritenum of me
-
- if tempRotation <> angle then
- set the rotation of sprite the spritenum of me to angle
- end if
- end
-
-
-
- ---
-
- on getPropertyDescriptionList
-
- set p_list = [ ¬
- #pointAtSpriteNum: [ #comment: "Point at sprite in channel:", ¬
- #format: #integer, ¬
- #default: 1 ] ¬
- ]
- return p_list
-
- end
-
- on getBehaviorDescription
- return ¬
- "Points a QT3 sprite at any other Director sprite." && RETURN & RETURN &¬
- "PARAMETERS:" && RETURN &¬
- "Point at sprite - Specify the channel # of the sprite to point at" && RETURN & RETURN & ¬
- "NOTE: Assumes QT3 sprite points left to right --> when angle is 0.0" && RETURN
-
- end
-